﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using ST.Buz.Base.Entity;
using ST.Buz.Base.Enums;

namespace ST.Buz.Base.Mapping
{
	public partial class Map_Sys_Role : IEntityTypeConfiguration<Sys_Role>
	{
		public void Config(EntityTypeBuilder<Sys_Role> builder)
		{
			builder.Property(e => e.StateNow)
				.HasDefaultValueSql("((" + (int)RoleState.正常 + "))")
				.ValueGeneratedNever();

			builder.Property(e => e.Code)
				.IsUnicode(false);

			builder.Property(e => e.Freezed)
				.HasDefaultValueSql("('0')")
				.ValueGeneratedNever();

			builder.Property(e => e.ChildVisible)
				.HasDefaultValueSql("('0')")
				.ValueGeneratedNever();

			builder.Property(e => e.Reserved)
				.HasDefaultValueSql("('0')")
				.ValueGeneratedNever();

			builder.Property(e => e.Sort)
				.HasDefaultValueSql("((0))")
				.ValueGeneratedNever();

			builder.Property(e => e.AddManID)
				.HasDefaultValueSql("((0))")
				.ValueGeneratedNever();

			builder.Property(e => e.AddDate)
				.HasDefaultValueSql("(getdate())")
				.ValueGeneratedNever();
		}
	}
}
